<?php
/*
 * name: gsl
 * desc: 文件 迁移表
 * date: 2018/09/21
 * */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateFilesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('files', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->string('path',255)->comment('文件地址');
            $table->string('name',50)->comment('文件名称');
            $table->string('origin_name', 255)->nullable()->comment('文件原名称');
            $table->string('mime_type',50)->nullable()->comment('文件格式');
            $table->string('extension',10)->nullable()->comment('后缀');
            $table->string('width',10)->nullable()->comment('宽度');
            $table->string('height',10)->nullable()->comment('高度');
            $table->timestamps();
            // $table->softDeletes();
        });
        // 表注释
        DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."files` comment'文件'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('files');
    }
}
